#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>

#define LOCKFILE "./ptmp"
int main()
{
	int pfd; /* Integer for file descriptor returned by open() call. */
	for(int i=0;i<9321;i++)
	{
		if ((pfd = open(LOCKFILE, O_WRONLY | O_CREAT )) == -1)
		{
			fprintf(stderr, "Cannot open /etc/ptmp. Try again later.\n");
			exit(1);
		}
		//close(pfd);
		printf("%d:File is Opened: %d\n",i,pfd);
	}
	sleep(1000);
}
